package com.cookor.poi.modules.test.util;

import com.sun.jna.Library;
import com.sun.jna.Native;

public class JnaUtil {

    interface JNALibrary extends Library {

        JNALibrary INSTANCE = (JNALibrary) Native.load("Project1", JNALibrary.class);

        /* 需要调用的方法,方法名与c++方法名相同 */
        String getName(String value);

        int getAge(int age);

        String setText(String parentClass, String parentTitle, String className, String titleName, String value);
    }

    public static void main(String[] args) throws Exception {
        System.setProperty("jna.encoding","gb18030");
        System.out.println(System.getProperty("java.version"));// 输出当前jdk版本号
        System.out.println(System.getProperty("sun.arch.data.model"));// 输出当前jdk所用平台

//        String name = JNALibrary.INSTANCE.getName("小红");
//        int age = JNALibrary.INSTANCE.getAge(3);
        String result = JNALibrary.INSTANCE.setText("#32770 (对话框)", "新建会话属性", "Edit", "新建会话", "测试");
        System.out.println(result);

    }

}
